/* $RCSFile: ADNDynCustomeraddress.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynCustomeraddress.cs $
 * $log$
 * Revision 19 2010/10/02 14:01:49  christian.surieux
 *   Corrected a bug in allmost everyADNDyn file for PrimaryFieldVualue
 * Revision 6 2010/08/06 19:56:32  christian.surieux
 *   Added Log to All cs files
 */

/* Copyrights Christian Surieux 2010 */
/* Class ADNDynCustomeraddress */
/* Date 2010-01-06 16:00:59Z */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
    public class ADNDynCustomeraddress : DynEntity
    {
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.customeraddress)
            {}

            public override Type DynType
            { get { return typeof(ADNDynCustomeraddress); } }

            public override string DynTypename
            {   get{ return CrmStr.customeraddress;}}

            public override DynEntity Build()
            {   return new ADNDynCustomeraddress();}

            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynCustomeraddress(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynCustomeraddress(w,PrimaryFieldValue);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynCustomeraddress(w,PrimaryKeyValue);}
        }

        static ADNDynCustomeraddress(){new Ftor();} 

        public override bool HasOwnerProperty
        {
            get { return false; }
        }
        
        public override bool HasOwningBusinessUnitProperty
        { get { return true; } }
        
        public ADNDynCustomeraddress() : base() { }
        
        public ADNDynCustomeraddress(CRMWrapperBase w,string PrimaryFieldValue)
            : base(w,CrmStr.customeraddress)
        {
            if ( PrimaryFieldValue != string.Empty )
                name = PrimaryFieldValue;
        }
        
        public ADNDynCustomeraddress(CRMWrapperBase w,Guid CrmId) : base(w,CrmStr.customeraddress,CrmId) { }
        
        public ADNDynCustomeraddress(CRMWrapperBase w,InternalDynamicEntity e) : base(w,CrmStr.customeraddress,e,null,null) { }
        
        public ADNDynCustomeraddress(CRMWrapperBase w,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(w,CrmStr.customeraddress,e,prop,s) { }
        
        public ADNDynCustomeraddress(ResetWrapperHandler fn,string PrimaryFieldValue)
            : base(fn,CrmStr.customeraddress)
        {
            if ( PrimaryFieldValue != string.Empty )
                name = PrimaryFieldValue;
        }
        
        public ADNDynCustomeraddress(ResetWrapperHandler fn,Guid CrmId) : base(fn,CrmStr.customeraddress,CrmId) { }
        
        public ADNDynCustomeraddress(ResetWrapperHandler fn,InternalDynamicEntity e) : base(fn,CrmStr.customeraddress,e,null,null) { }
        
        public ADNDynCustomeraddress(ResetWrapperHandler fn,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(fn,CrmStr.customeraddress,e,prop,s) { }

        /* Properties */

        [CrmDynAttribute(CrmStr.customeraddress)]
        public Guid customeraddressid
        {
            get
            { return KeyPropertyValue(CrmStr.customeraddressid); }
            set
            { AddKeyProperty(CrmStr.customeraddressid,value); }
        }

        protected override void SetCrmIdProperty(Guid crmId)
        {
            if ( !dicProperty.ContainsKey(CrmStr.customeraddressid) || KeyPropertyValue(CrmStr.customeraddressid) != crmId )
                customeraddressid = crmId;
        }
        public override Guid PrimaryKeyGuidValue
        {
            get
            { return customeraddressid; }
            set { customeraddressid = value; }
        }
        public override string PrimaryFieldName
        {
            get
            { return CrmStr.name; }
            set
            {}
        }

        /// <summary>
        /// Value contained in the PrimaryField for the DynEntity or empty if no PrimaryField
        /// </summary>
        public override string PrimaryFieldStringValue
        {
            get
            {
                return name;
            }
            set
            {
                name =   value;
            }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public int addressnumber
        {
            get
            { return NumberPropertyValue(CrmStr.addressnumber); }
            set
            { AddNumberProperty(CrmStr.addressnumber,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public int addresstypecode
        {
            get
            { return PicklistPropertyIntValue(CrmStr.addresstypecode); }
            set
            { AddPicklistProperty(CrmStr.addresstypecode,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string addresstypecodeLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.addresstypecode); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string city
        {
            get
            { return StringPropertyValue(CrmStr.city); }
            set
            { AddStringProperty(CrmStr.city,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string country
        {
            get
            { return StringPropertyValue(CrmStr.country); }
            set
            { AddStringProperty(CrmStr.country,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string county
        {
            get
            { return StringPropertyValue(CrmStr.county); }
            set
            { AddStringProperty(CrmStr.county,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string fax
        {
            get
            { return StringPropertyValue(CrmStr.fax); }
            set
            { AddStringProperty(CrmStr.fax,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public int freighttermscode
        {
            get
            { return PicklistPropertyIntValue(CrmStr.freighttermscode); }
            set
            { AddPicklistProperty(CrmStr.freighttermscode,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string freighttermscodeLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.freighttermscode); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public double latitude
        {
            get
            { return DoublePropertyValue(CrmStr.latitude); }
            set
            { AddFloatProperty(CrmStr.latitude,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string line1
        {
            get
            { return StringPropertyValue(CrmStr.line1); }
            set
            { AddStringProperty(CrmStr.line1,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string line2
        {
            get
            { return StringPropertyValue(CrmStr.line2); }
            set
            { AddStringProperty(CrmStr.line2,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string line3
        {
            get
            { return StringPropertyValue(CrmStr.line3); }
            set
            { AddStringProperty(CrmStr.line3,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public double longitude
        {
            get
            { return DoublePropertyValue(CrmStr.longitude); }
            set
            { AddFloatProperty(CrmStr.longitude,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public override string name
        {
            get
            { return StringPropertyValue(CrmStr.name); }
            set
            { AddStringProperty(CrmStr.name,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string objecttypecode
        {
			get
			{
				return EntityNameReferencePropertyValue(CrmStr.objecttypecode);
			}
			set
			{
                switch ( value )
                {
                    case CrmStr.account:
                    case CrmStr.contact:
                    case CrmStr.lead:
                    AddEntityNameReferenceProperty(CrmStr.objecttypecode,value);
                    break;
                }
			}
		}

        [CrmDynAttribute(CrmStr.customeraddress)]
        public Guid owningbusinessunit
        {
            get
            { return LookupPropertyValue(CrmStr.owningbusinessunit); }
            set
            { AddLookupProperty(CrmStr.owningbusinessunit,CrmStr.businessunit,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public Guid owninguser
        {
            get
            { return LookupPropertyValue(CrmStr.owninguser); }
            set
            { AddLookupProperty(CrmStr.owninguser,CrmStr.systemuser,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public Guid parentid
        {
            get
            { return LookupPropertyValue(CrmStr.parentid); }
            set
            { AddLookupProperty(CrmStr.parentid,objecttypecode,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string postalcode
        {
            get
            { return StringPropertyValue(CrmStr.postalcode); }
            set
            { AddStringProperty(CrmStr.postalcode,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string postofficebox
        {
            get
            { return StringPropertyValue(CrmStr.postofficebox); }
            set
            { AddStringProperty(CrmStr.postofficebox,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string primarycontactname
        {
            get
            { return StringPropertyValue(CrmStr.primarycontactname); }
            set
            { AddStringProperty(CrmStr.primarycontactname,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public int shippingmethodcode
        {
            get
            { return PicklistPropertyIntValue(CrmStr.shippingmethodcode); }
            set
            { AddPicklistProperty(CrmStr.shippingmethodcode,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string shippingmethodcodeLabel
        {
            get
            { return PicklistPropertyLabelValue(CrmStr.shippingmethodcode); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string stateorprovince
        {
            get
            { return StringPropertyValue(CrmStr.stateorprovince); }
            set
            { AddStringProperty(CrmStr.stateorprovince,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string telephone1
        {
            get
            { return StringPropertyValue(CrmStr.telephone1); }
            set
            { AddStringProperty(CrmStr.telephone1,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string telephone2
        {
            get
            { return StringPropertyValue(CrmStr.telephone2); }
            set
            { AddStringProperty(CrmStr.telephone2,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string telephone3
        {
            get
            { return StringPropertyValue(CrmStr.telephone3); }
            set
            { AddStringProperty(CrmStr.telephone3,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public int timezoneruleversionnumber
        {
            get
            { return NumberPropertyValue(CrmStr.timezoneruleversionnumber); }
            set
            { AddNumberProperty(CrmStr.timezoneruleversionnumber,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public string upszone
        {
            get
            { return StringPropertyValue(CrmStr.upszone); }
            set
            { AddStringProperty(CrmStr.upszone,value); }
        }

        [CrmDynAttribute(CrmStr.customeraddress)]
        public int utcoffset
        {
            get
            { return NumberPropertyValue(CrmStr.utcoffset); }
            set
            { AddNumberProperty(CrmStr.utcoffset,value); }
        }
    }
}